<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script>
</head>

<body>
    <div id="app">
        <!-- <button @click="handler">修改基本数据类型</button> -->
        <!-- <button @click="handler">修改数组类型</button> -->
        <button @click="handler">修改对象类型</button>


        <ul>
            <!-- <li v-for="item in fruit" :key="item">{{item}}</li>
             -->
            <li v-for="value,key in person" :key="item">{{key}}---{{value}}</li>
        </ul>
    </div>
    <script>
        Vue.config.productionTip = false;

        const vm = new Vue({
            el: "#app",
            data() {
                return {
                    msg: "hellow",
                    fruit: ["西瓜", "西梅", "葡萄", "苹果"],
                    person: {
                        name: "xiaowang",
                        age: 19,
                        sex: "nana",
                        hobby: {
                            bool: 50,
                            book: 90
                        }
                    }
                }
            },
            methods: {
                handler() {
                    console.log(this);
                    this.$data.msg = "hhah",
                    this.fruit.push("香蕉"),
                    this.$set(this.person, "height", 185);
                    this.$delete(this.person,"sex")
                }
            },
        })
    </script>
</body>

</html>